class Solution {
public:
    bool repeatedSubstringPattern(string s) {
        for (int i = 0; i < s.size() / 2; i++) {
            string str = s.substr(0, i + 1);
            string temp = str;
            while (temp.size() <= s.size()) {
                if (temp == s) return true;
                temp += str;
            }
        }
        return false;
    }
};